package com.howie.common.valid;

import javax.validation.Constraint;
import javax.validation.Payload;
import javax.validation.constraints.NotEmpty;
import java.lang.annotation.Documented;
import java.lang.annotation.Repeatable;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.ElementType.TYPE_USE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
 * @description: 自定义的校验注解，校验显示状态字段ShowStatus，字段值只能是0或1
 * @author: laizhenghua
 * @date: 2020/12/17 15:10
 */
@Documented
@Constraint(validatedBy = {ListValueConstraintValidator.class}) // 指定校验器
@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE }) // 指明校验注解声明的地方
@Retention(RUNTIME)
public @interface ListValue {

    String message() default "{com.howie.common.valid.ListValue.message}";

    Class<?>[] groups() default { };

    Class<? extends Payload>[] payload() default { };
    int[] value() default {};
}
